﻿using System;
using System.Collections.Generic;
using System.Configuration;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Xml;

namespace MRSite.DataAccess.Config
{
    public class DataAccessSection : IConfigurationSectionHandler
    {
        private const string DATABASE_LIST_FILE = "databaseListFile";

        public object Create(object parent, object configContext, XmlNode section)
        {
            var dataAccessInfo = new DataAccessInfo();
            if (section != null && section.Attributes != null)
            {
                if (section.Attributes[DATABASE_LIST_FILE] != null
                    && string.IsNullOrWhiteSpace(section.Attributes[DATABASE_LIST_FILE].Value))
                {
                    dataAccessInfo.DatabaseListFile = section.Attributes[DATABASE_LIST_FILE].Value.Trim();
                }
            }
            return dataAccessInfo;
        }
    }

    public class DataAccessInfo
    {
        public string DatabaseListFile { get; set; }
    }
}
